#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    srand(time(NULL));
    int n,m,tmp,ff;
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>tmp;
    for(int j=1;j<=m;j++)cin>>tmp;
    for(int i=1;i<=n;i++){
        if((1<<i)>=n){ff=i;break;}
    }
    cin>>tmp;
    for(int i=1;i<=tmp;i++){
        cout<<rand()%(1<<(ff))<<'\n';
    }
}
